package com.ruoyi.exam.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.exam.domain.PExamNum;
import com.ruoyi.exam.domain.PExamNumExample;
import com.ruoyi.exam.domain.PExamNumb;
import com.ruoyi.exam.mapper.PExamNumMapper;
import com.ruoyi.exam.mapper.PExamNumbMapper;
import com.ruoyi.exam.service.IPExamNumbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 默认考试数量Service业务层处理
 *
 * @author jiadun
 * @date 2022-01-05
 */
@Service
public class PExamNumbServiceImpl implements IPExamNumbService
{
    @Autowired
    private PExamNumbMapper pExamNumbMapper;

    @Autowired
    private PExamNumMapper pExamNumMapper;

    /**
     * 查询默认考试数量
     *
     * @param id 默认考试数量主键
     * @return 默认考试数量
     */
    @Override
    public PExamNumb selectPExamNumbById(Long id)
    {
        return pExamNumbMapper.selectPExamNumbById(id);
    }

    /**
     * 查询默认考试数量列表
     *
     * @param pExamNumb 默认考试数量
     * @return 默认考试数量
     */
    @Override
    public List<PExamNumb> selectPExamNumbList(PExamNumb pExamNumb)
    {
        return pExamNumbMapper.selectPExamNumbList(pExamNumb);
    }

    /**
     * 新增默认考试数量
     *
     * @param pExamNumb 默认考试数量
     * @return 结果
     */
    @Override
    public int insertPExamNumb(PExamNumb pExamNumb){
      pExamNumb.setCreateTime(DateUtils.getNowDate());
      return pExamNumbMapper.insertPExamNumb(pExamNumb);
    }

    /**
     * 修改默认考试数量
     *
     * @param pExamNumb 默认考试数量
     * @return 结果
     */
    @Override
    public int updatePExamNumb(PExamNumb pExamNumb)
    {
        pExamNumb.setUpdateTime(DateUtils.getNowDate());
        return pExamNumbMapper.updatePExamNumb(pExamNumb);
    }

    /**
     * 批量删除默认考试数量
     *
     * @param ids 需要删除的默认考试数量主键
     * @return 结果
     */
    @Override
    public int deletePExamNumbByIds(Long[] ids)
    {
        return pExamNumbMapper.deletePExamNumbByIds(ids);
    }

    /**
     * 删除默认考试数量信息
     *
     * @param id 默认考试数量主键
     * @return 结果
     */
    @Override
    public int deletePExamNumbById(Long id)
    {
        return pExamNumbMapper.deletePExamNumbById(id);
    }

    @Override
    public PExamNumb selectPExamNumbByOne() {
        return pExamNumbMapper.selectPExamNumbByOne();
    }

    @Override
    public int insertPExamNumb(PExamNum pExamNum) {
      int isFinish = pExamNumMapper.insert(pExamNum);
      return isFinish;
    }

    @Override
    public int updatePExamNum(PExamNum pExamNum) {
      PExamNumExample pExamNumExample = new PExamNumExample();
      pExamNumExample.createCriteria().andIdEqualTo(pExamNum.getId());
      return pExamNumMapper.updateByExampleSelective(pExamNum, pExamNumExample);
    }

    @Override
    public int deletePExamNumbByIds(Long id) {
      return pExamNumbMapper.deletePExamNumbById(id);
    }

    @Override
    public List<PExamNum> selectPExamNumList() {
      return pExamNumMapper.selectAll();
    }

    @Override
    public PExamNum selectPExamNumById(Long id) {
      return pExamNumMapper.selectByPrimaryKey(id);
    }

  @Override
    public int deletePExamNumByIds(Long[] ids) {
      return pExamNumMapper.deletePExamNumByIds(ids);
    }

  @Override
      public PExamNum selectOne() {
        return  pExamNumMapper.selectRandomOne();
      }

}
